package net.googlecode.garzha.controllers;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;

@Controller
/**
 *  Controller of login page.
 */
public class IndexController {

    protected static final Logger logger = Logger.getLogger(IndexController.class);

    @RequestMapping(value = {"/index", "/"})
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        Map<String, Object> mp = new TreeMap<String, Object>();
        mp.put("root", request.getContextPath());
        logger.info("Returning login view");
        return new ModelAndView("index", mp);
    }

}